package com.kazm.toolkit.common;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.beans.*;

public class Com {
	public void print(String txt) {
		System.out.print(txt);
	}

	public void println(String txt) {
		System.out.println(txt);
	}

	public String readln() throws IOException {
		String str;
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		str = in.readLine();
		return str;
	}

	public void printObjectAttr(Object obj) {
		for (Field field : obj.getClass().getDeclaredFields()) {
			field.setAccessible(true);
			String name = field.getName();
			Object value = null;
			try {
				value = field.get(obj);
			} catch (IllegalArgumentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			System.out.printf("%s: %s%n", name, value);
		}
		System.out.println();
	}

	public List<String> deleteSubstring(List<String> list, String string) {
		List<String> mappedList = new ArrayList<String>();
		for (String str : list) {
			mappedList.add(str.replace(string, ""));
		}
		return mappedList;
	}

	public List<String> addPrefix(List<String> list, String prefix) {
		List<String> mappedList = new ArrayList<String>();
		for (String str : list) {
			mappedList.add(prefix.concat(str));			
		}
		return mappedList;
	}

	public List<String> addSuffix(List<String> list, String suffix) {
		List<String> mappedList = new ArrayList<String>();
		for (String str : list) {
			mappedList.add(str.concat(suffix));
		}
		return mappedList;
	}
}
